<!DOCTYPE html>
<html>
        <head>
        <title>Page Title</title>
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
        <script type="text/javascript" src="../js/jquery.mobile.router-dev.js"></script>
        <script type="text/javascript" src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
        <script type="text/javascript">
	var router=new $.mobile.Router([
		{ "#index": { 
			handler: function(type){
				console.log("Index has been "+(type=="pagehide"?"hidden":"shown"));
			}, events: "h,s" }
		},
		{ "externalUrl(?:[?/](.*))?": {handler: "testBL", events: "bl" } }
	],{
		testBL: function(type,match,data,scope,e){
			console.log("document event! "+type);
			e.preventDefault();
			var page=$('<div data-role="page"><div data-role="header"><h1>title</h1></div><div data-role="content">page4content<a data-role="button" href="#index">back to index</a></div></div>').appendTo("body");
			data.deferred.resolve(data.absUrl, data.options, page );
		}
	}, { ajaxApp: true });
        </script>
</head>

<body>

<div data-role="page" id="index">
        <div data-role="header">
                <h1>Index</h1>
        </div>

        <div data-role="content">
                <p>Page 1</p>
                <p>The output of this page can be seen in your javascript console.</p>
                <p>
			The following link will show how to inject a page using the pagebeforeload evt<br/>
                        <a href="externalUrl?blablabl">external url</a><br/>
                </p>
        </div>

        <div data-role="footer">
                <h4>Index footer</h4>
        </div>
</div>
</html>
